#ifndef LANDBLOCK_H
#define LANDBLOCK_H

#include <QLabel>
#include "landblockmask.h"
#include "landblockcontent.h"
#include "pos.h"

class LandBlock : public QWidget
{
    Q_OBJECT
public:
    explicit LandBlock();
    explicit LandBlock(QWidget *parent=nullptr);
    explicit LandBlock(bool hasLandMine, QWidget *parent = nullptr);
    explicit LandBlock(Pos *blockPos, QWidget *parent = nullptr);
    explicit LandBlock(bool hasLandMine, Pos *blockPos, QWidget *parent = nullptr);

public:
    void initialize();
    LandBlockMask *getMask() const;
    void setMask(LandBlockMask *newMask);
    LandBlockContent *getContent() const;
    void setContent(LandBlockContent *newContent);
    bool getIsSearch() const;
    void setIsSearch(bool newIsSearch);

    bool getHasLandMine() const;
    void setHasLandMine(bool newHasLandMine);

    void resetMask();
    void resetContent();
    void resetIsSearch();
    void resetHasLandMine();

    Pos *getBlockPos() const;
    void setBlockPos(Pos *newBlockPos);
    void resetBlockPos();

signals:
    void maskChanged();

    void contentChanged();

    void isSearchChanged();

    void hasLandMineChanged();

    void blockPosChanged();

public slots:
    void searchBlock();
    void placeLandMine();

private:
    LandBlockMask *mask = new LandBlockMask(this);
    LandBlockContent *content = new LandBlockContent(this);
    bool isSearch = false;
    bool hasLandMine = false;
    Pos *blockPos;
};

#endif // LANDBLOCK_H
